package com.edu.myenum;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat.Shape;

@JsonFormat(
        shape = Shape.OBJECT
)
public enum StateEnum {
    WARN(103, "存在不正常的数据！"),
    SUCCESS(200, "请求成功"),
    BAD_REQUEST(400, "请求不完整"),
    NO_PERMISSION(401, "未授权"),
    REQUEST_404(404, "请求找不到"),
    ERROR(500, "请求失败"),
    NOT_IMPLEMENTED_REQUEST(501, "请求未实现或未开启"),
    HYSTRIX_FALLBACK(502, "Fallback异常"),
    REQUEST_DUPLICATE(503, "请求重复提交"),
    UNAVAILABLE_GATEWAY(50001, "网关超时"),
    UNAVAILABLE_SERVICE(50002, "服务不可用"),
    CLIENT_INVOKE_EXCEPTION(50003, "客户端调用异常"),
    CONNECT_ERROR(50004, "网络连接错误"),
    SOCKET_READ_TIMEOUT(50005, "网络超时"),
    HYSTRIX_TIMEOUT(50006, "Hystrix断路器超时"),
    HYSTRIX_THREAD_POOL_FULL(50007, "Hystrix线程池已满"),
    HYSTRIX_CIRCUITBREAKER_OPEN(50008, "Hystrix断路器已打开"),
    HYSTRIX_SEMAPHORE_NOT_ACQUIRED(50009, "Hystrix信号量未获取"),
    ILLEGAL_REQUEST(6010101, "非法请求"),
    ILLEGAL_IP(6010102, "IP被禁止"),
    ILLEGAL_PERMISSION(6010103, "未授权"),
    ILLEGAL_PERMISSION_LIMIT(6010104, "接口限流"),
    ILLEGAL_PERMISSION_SUBMIT_LIMIT(6010105, "接口限制提交"),
    ILLEGAL_CLIENT_ID_SECRET(6020101, "授权ID或密钥错误"),
    ILLEGAL_AUTHORIZE_CODE(6020102, "授权码错误"),
    ILLEGAL_LOGIN_STATE(6020103, "未登录"),
    ILLEGAL_LOGIN(6020104, "登录异常"),
    ILLEGAL_VALID_CODE(6020105, "验证码错误"),
    ILLEGAL_ACCOUNT_PASSWORD(6020106, "用户名或密码错误"),
    ILLEGAL_ACCOUNT_INACTIVE(6020107, "用户未激活"),
    ILLEGAL_ACCOUNT_EXPIRED(6020108, "用户过期"),
    ILLEGAL_ACCOUNT_EXPIRED_CREDENTIALS(6020109, "密码过期"),
    ILLEGAL_ACCOUNT_DISABLED(6020110, "用户被禁用"),
    ILLEGAL_ACCOUNT_LOCKED(6020111, "用户被锁定"),
    ILLEGAL_ACCOUNT_UNKOWN(6020112, "未知账号");
    private int code;
    private String text;

    private StateEnum(int code) {
        this.code = code;
        this.text = "" + code;
    }

    private StateEnum(int code, String text) {
        this.code = code;
        this.text = text;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getText() {
        return this.text;
    }

    public void setText(String text) {
        this.text = text;
    }
}
